<template>
	<view class="content">
		<view style="">
			<view style="background-color: #0081FF;height: 50px;"></view>
			<view class="userinfo">
				<image class="userinfo-img" :src="userInfo.AvatarUrl ? userInfo.AvatarUrl : '/static/img/hicLogo.png'" mode=""></image>
				<view class="margin-bottom">{{ userInfo.RealName }}</view>
				<view>{{ userInfo.Phone }}</view>
			</view>
		</view>
		<view v-if="userInfo.Phone" class="cu-list menu sm-border">
			<view v-for="(item, index) in partsList" class="cu-item arrow" @click="go" :data-item="item" :key="item.code">
				<text class="text-grey">{{ item.name }}</text>
			</view>
		</view>
	</view>
</template>

<script>
import { showToast } from '@/utils/util.js';
import { partsList } from './util.js';
export default {
	data() {
		return {
			session: {},
			userInfo: {
				RealName: '',
				AvatarUrl: '',
				Phone: ''
			},
			partsList: [],
			
		};
	},
	created() {
		this.partsList = partsList;
	},
	onShow() {
		// this._userInfo = this.$store.state.uni.UserInfo;
	},
	onLoad(options) {},
	mounted() {
		const session = uni.getStorageSync('session');
		this.session = session;
		this.$store.dispatch('uni/UserInfo', { openid: this.session.openid }).then(res => {
			this.userInfo = res.Data || {};
			console.log('?????',this.userInfo)
		});
	},
	onShow() {},
	methods: {
		go(e) {
			console.log(e.currentTarget.dataset);
			const { item } = e.currentTarget.dataset;
			uni.navigateTo({
				url: item.url
			});
		}
	}
};
</script>

<style scoped lang="scss">
.userinfo {
	background: #fff;
	border-radius: 15px;
	position: relative;
	top: -20px;
	display: flex;
	justify-content: center;
	align-items: center;
	flex-direction: column;
	height: 180px;
	color: #666;
	font-size: 16px;
	&-img {
		position: absolute;
		top: -30px;
		margin-bottom: 50px;
		width: 80px;
		height: 80px;
		border: 1px solid #ccc;
		background-color: #fff;
		border-radius: 100px;
	}
	&-phone {
		margin: 45px 0 25px;
	}
	&-order {
		&-type {
			margin-right: 10px;
		}
	}
}
</style>
